﻿using Assets.Scripts.Interface;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StarPill :AProp{

    private Entity entity;//获取拾得此物体的Entity脚本
    public override void Click()
    {
        if (entity!=null)//判断是否血量已达上限
        {
            if (entity.Hp < entity.HpLimit)
            {
                ReduceCount(1);
                GameManager.Instance.Sui.GetComponent<Player>().Hp += 1;
            }
        }
    }//点击事件

    public override void FixedAwake()
    {
        info = "帮助玩家恢复一滴血";//星丸的介绍
    }

    protected override void OnTriggerEnter(Collider other)
    {
        base.OnTriggerEnter(other);
        entity=other.GetComponent<Entity>();
    }//触发主角碰撞事件
}
